#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1005;
const int M = 1e4 + 5;

int n, m, k;
int f[N];
void init(int n) { rep(i, 1, n) f[i] = i; }
int find(int x) { return f[x] == x ? x : f[x] = find(f[x]); }
bool merge(int x, int y) {
  int fx = find(x), fy = find(y);
  if (fx == fy) return false;
  f[fy] = fx;
  return true;
}
struct Edge {
  int x, y, z;
  bool operator<(Edge o) const { return z < o.z; }
} e[M];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m >> k;
  init(n);
  rep(i, 1, m) cin >> e[i].x >> e[i].y >> e[i].z;
  sort(e + 1, e + m + 1);
  int cnt = n - k;
  ll ans = 0;
  if (cnt <= 0) {
    cout << 0;
    return 0;
  }
  rep(i, 1, m) {
    if (merge(e[i].x, e[i].y)) {
      cnt--;
      ans += e[i].z;
      if (!cnt) break;
    }
  }
  if (!cnt)
    cout << ans;
  else
    cout << "No Answer";
  return 0;
}